import api from "../api/index";
import Axios from '../utils/axios'

export interface queryObject{
    limit?: number;
    page?: number;
    name?:string;
    state?:string;
    createTime?: string | Date;
    serial?:string;
    parentId?:number;
    level?:string;
    iconUrl?:string;
    sort?:string;
    updateTime?:string;
    id?:number;
}
//商品分类展示
function getCategoryList(){
    return Axios.get(api.shopCategory.Category_FindAll)
}
//商品模糊查询
function CategoryQuery(obj: queryObject){
  
    return Axios.post(api.shopCategory.Category_PageList,obj)
}
//商品分类添加
function CategoryAdd(obj:queryObject){
    console.log("请求传参",obj)
    return Axios.post(api.shopCategory.Category_Add,obj)
    
}
//商品分类编辑
function CategoryUpdate(obj:queryObject){
    return Axios.post(api.shopCategory.Category_Update,obj)
}
//商品分类根据id查询
function CategoryId(id:any){
    return Axios.get(api.shopCategory.Category_Id+id)
}
//商品分类根据id删除
function categoryDelete(id:number){
    console.log("id",id);
    
    return Axios.get(api.shopCategory.Category_Delete+id)

}
export default{
    getCategoryList,
    CategoryQuery,
    CategoryAdd,
    CategoryUpdate,
    CategoryId,
    categoryDelete
}